package customview.ike.com.customviewproject.widget.Refresh;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

/**
 * Created by Administrator on 2018/5/8.
 */

public class PullAbleListLinearLayout extends LinearLayout implements PullAbleView{
    
    private PullAbleRecyclerView pullAbleRecyclerView;
    public PullAbleListLinearLayout(Context context) {
        this(context,null);
    }

    public PullAbleListLinearLayout(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public PullAbleListLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean canPullDown() {
        if (pullAbleRecyclerView.getVisibility()==VISIBLE){
            return pullAbleRecyclerView.canPullDown();
        }else {
            return true;
        }
        
    }

    @Override
    public boolean canPullUp() {
        if (pullAbleRecyclerView.getVisibility()==VISIBLE){
            return pullAbleRecyclerView.canPullUp();
        }else {
            return true;
        }
    }
    public void setPullAbleRecyclerView(PullAbleRecyclerView pullAbleRecyclerView) {
        this.pullAbleRecyclerView = pullAbleRecyclerView;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);
        return true;
    }
}
